package com.seecen.controller;

import com.seecen.pojo.Dictionary;
import com.seecen.service.DictionaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/dictionary")
public class DictionaryController {

    @Autowired
    private DictionaryService dictionaryService;

    @GetMapping("/find/{pid}")
    @ResponseBody
    public List<Dictionary> findByPid(@PathVariable("pid") int pid){
        return dictionaryService.findRegionsByParent(pid);
    }
}
